/** \file    gdiplus.h
  * \brief   Image IO operations using GDI+
  * \date    2003
  * \author  Fedor Chelnokov
  * \version $Header: /home/cscom1r4/cvsroot/cs/include/imglib/gdiplus.h,v 1.3 2004/06/05 14:16:27 cscom1r4 Exp $
  */

#ifndef _gdiplus_h_
#define _gdiplus_h_

// Usage:
//
// 0) GDI+ Bitmap creation (attaching to image in memory, no copying inside)
// std::auto_ptr<Gdiplus::Bitmap> = create(img::bitmap);
// std::auto_ptr<Gdiplus::Bitmap> = create(mono_byte_image);
// std::auto_ptr<Gdiplus::Bitmap> = create(small_byte_image);
// std::auto_ptr<Gdiplus::Bitmap> = create(byte_image, bool alpha = true);
//
// 1) writing
// std::ostream << img::gdiplus(img::bitmap, img::format);
// std::ostream << img::gdiplus(mono_byte_image, img::format);
// std::ostream << img::gdiplus(small_byte_image, img::format);
// std::ostream << img::gdiplus(byte_image, img::format, bool alpha = false);
//
// 2) reading
// std::istream >> img::gdiplus(img::bitmap, img::format = any_format)
// std::istream >> img::gdiplus(mono_byte_image, img::format = any_format)
// std::istream >> img::gdiplus(small_byte_image, img::format = any_format)
// std::istream >> img::gdiplus(byte_image, img::format = any_format, bool alpha = false)
// std::istream >> img::gdiplus(byte_image, bool * read_alpha, img::format = any_format, bool alpha = false)
//

#include <memory>
#include <iostream>
#include "imageclass_decl.h"

namespace Gdiplus { class Bitmap; }

namespace img {

template <class R>
std::auto_ptr<Gdiplus::Bitmap> create(R const & r, bool alpha = true);

enum format
{
	bmp_format,
	jpeg_format,
	gif_format,
	tiff_format,
	png_format,
	any_format ///< indicates image reading
};

/////////////
// Encoder //
/////////////

template <class R>
class gdiplus_encoder;

template <class R>
inline gdiplus_encoder<R> gdiplus(const R & b, format f, bool a = false);

/////////////////////
// Encoder/Decoder //
/////////////////////

template <class R>
class gdiplus_coder;

template <class R>
inline gdiplus_coder<R> gdiplus(R & b, format f = any_format, bool a = false);

//for reading with alpha channel checking
template <class R>
inline gdiplus_coder<R> gdiplus(R & b, bool * read_alpha, format f = any_format, bool a = false);


#include "gdiplus.inl"

} //namespace img

#endif //_gdiplus_h_
